<template>
  <div class="player" v-show="playList.length>0">
    <transition
      name="normal"
      @enter="enter"
      @after-enter="afterEnter"
      @leave="leave"
      @after-leave="afterLeave"
    >
      <div class="normal-player" v-show="fullScreen">
        <div class="background">
          <img :src="currentSong.image" alt width="100%" height="100%" />
        </div>
        <div class="top">
          <div class="back" @click="back">
            <i class="iconfont iconfanhui"></i>
          </div>
          <h1 class="title" v-html="currentSong.name"></h1>
          <h2 class="subtitle" v-html="currentSong.singer">周杰伦</h2>
        </div>
        <div class="audio-voice-control" v-show="currentShow==='lyric'">
          <i class="iconfont iconVoice" :class="ismute" @click="togglemute"></i>
          <van-slider
            v-model="volume"
            bar-height="3"
            button-size="16"
            inactive-color="rgba(255,255,255,0.3)"
            active-color="rgba(255,255,255,1)"
            @input="voiceChange"
            class="vanslider"
          />
          <i class="iconfont icontv iconVoice" @click="gotv"></i>
        </div>
        <!-- 暂时禁用移动切换： -->
        <!-- @touchstart.prevent="middleTouchStart"
          @touchmove.prevent="middleTouchMove"
        @touchend="middleTouchEnd"-->
        <div class="middle" @click.stop="middleClick">
          <div class="middle-l" ref="middleL">
            <div class="cd-wrapper" ref="cdWrapper">
              <div id="effect-music">
                <div class="image"></div>
                <div class="wave"></div>
                <div class="wave"></div>
                <div class="wave"></div>
                <div class="wave"></div>
              </div>
              <div class="cd" :class="cdCls">
                <img :src="currentSong.image" alt class="image" />
              </div>
            </div>
            <div class="playing-lyric-wrapper">
              <div class="playing-lyric">{{playingLyric}}</div>
            </div>
          </div>
          <scroll class="middle-r" ref="lyricList" :data="currentLyric && currentLyric.lines">
            <div class="lyric-wrapper">
              <div v-if="currentLyric">
                <p
                  ref="lyricLine"
                  class="text"
                  v-for="(line,index) in currentLyric.lines"
                  :key="index"
                  :class="{'current':currentLineNum===index}"
                >{{line.txt}}</p>
              </div>
              <div v-else class="nolyric">暂无歌词~</div>
            </div>
          </scroll>
        </div>
        <div class="bottom">
          <div class="dot-wrapper dot-wrapper-flex">
            <!-- <span class="dot" :class="{'active':currentShow==='cd'}"></span>
            <span class="dot" :class="{'active':currentShow==='lyric'}"></span>-->
            <div class="commenticon" @click="tocomment(currentSong.id)">
              <i class="iconfont iconxinxi"></i>
              <span v-html="CommentNum"></span>
            </div>

            <i class="iconfont iconfontlyric" :class="showLyric" @click="toggleLyric"></i>
          </div>
          <div class="progress-wrapper">
            <span class="time time-l">{{formatTime(currentTime)}}</span>
            <div class="progress-bar-wrapper">
              <progress-bar :percent="percent" @percentChange="onProgressBarChange"></progress-bar>
            </div>
            <span class="time time-r">{{formatTime(currentSong.duration)}}</span>
          </div>
          <div class="operators">
            <div class="icon i-left" @click="changeMode">
              <i class="iconfont" :class="iconMode"></i>
            </div>
            <div class="icon i-left" :class="disableCls">
              <!-- 点击播放上一首歌曲 -->
              <i class="iconfont iconprev" @click="prev"></i>
            </div>
            <div class="icon i-center">
              <!-- 点击切换播放暂停功能： -->
              <i class="iconfont" :class="playIcon" @click="togglePlaying"></i>
            </div>
            <div class="icon i-right" :class="disableCls">
              <!-- 点击播放下一首歌曲 -->
              <i class="iconfont iconnext" @click="next"></i>
            </div>
            <div class="icon i-right">
              <!-- 使用mixin中的方法来做切换 -->
              <!-- <vue-star
                animate="animated rubberBand"
                color="#ffcd32"
                v-if="!isFavorite(currentSong)"
              >
                <i
                  slot="icon"
                  class="iconfont"
                  :class="getFavoriteIcon(currentSong)"
                  @click="toggleFavorite(currentSong)"
                ></i>
              </vue-star>-->
              <i
                class="iconfont"
                :class="getFavoriteIcon(currentSong)"
                @click="toggleFavorite(currentSong)"
                ref="likeRef"
              ></i>
            </div>
          </div>
        </div>
      </div>
    </transition>
    <transition name="mini">
      <div class="mini-player" v-show="!fullScreen" @click="open" ref="MiniPlayer">
        <div class="icon">
          <div class="imgWrapper">
            <img :class="cdCls" :src="currentSong.image" width="40" height="40" alt />
          </div>
        </div>
        <div class="text">
          <h2 class="name" v-html="currentSong.name"></h2>
          <p class="desc" v-html="currentSong.singer"></p>
        </div>
        <div class="control">
          <progress-circle :radius="32" :percent="percent">
            <i class="iconfont icon-mini" :class="miniIcon" @click.stop="togglePlaying"></i>
          </progress-circle>
        </div>
        <div class="control" @click.stop="showPlayList">
          <i class="iconfont iconsmlist" :class="{'on':playList}"></i>
        </div>
      </div>
    </transition>
    <!-- 播放列表： -->
    <playlist ref="playlist"></playlist>
    <!-- 播放器： -->
    <audio
      :src="currentSong.url"
      ref="audio"
      @play="ready"
      @error="MusicError"
      @timeupdate="updateTime"
      @ended="Musicend"
    ></audio>
  </div>
</template>

<script>
import { mapGetters, mapMutations, mapActions } from "vuex";
import animations from "create-keyframe-animation";
import { Slider } from "vant";
import { checkMusic } from "@/request/api";
import { prefixStyle } from "@/utils/dom.js";
import ProgressBar from "@/base/progress-bar/progress-bar";
import ProgressCircle from "@/base/progress-circle/progress-circle";
const transform = prefixStyle("transform");
const transitionDuration = prefixStyle("transitionDuration");
import { playMode } from "@/utils/config.js";

import Lyric from "lyric-parser";
import Scroll from "@/base/scroll/scroll";
import { playerMixin } from "@/common/mixin";
import Playlist from "@/components/playlist/playlist";
import PubSub from "pubsub-js";
import VueStar from "vue-star";

export default {
  mixins: [playerMixin],
  data() {
    return {
      songReady: false,
      currentTime: 0,
      // 当前歌曲的歌词：
      currentLyric: null,
      // 当前歌词的位置(行)：
      currentLineNum: 0,
      // 当前显示cd还是显示歌词：
      currentShow: "cd",
      playingLyric: "",
      // 默认百分之十的音量：
      volume: 50,
      // 是否静音
      mute: false,
      // 当前歌曲播放量：
      CommentNum: "0"
    };
  },
  computed: {

    // 获取状态：
    ...mapGetters(["fullScreen", "playing", "currentIndex", "playOptions"]),
    ismute() {
      return this.mute ? "iconMute" : "iconvolume";
    },

    playIcon() {
      return this.playing ? "iconpluse" : "iconplay";
    },
    miniIcon() {
      return this.playing ? "iconMinipluse" : "iconMiniPlay";
    },
    cdCls() {
      return this.playing ? "play" : "play pause";
    },
    disableCls() {
      return this.songReady ? "" : "disable";
    },
    percent() {
      // 播放比例就是当前的播放时间除以总时长
      return this.currentTime / this.currentSong.duration;
    },
    showLyric() {
      if (this.currentShow === "cd") {
        return "icongeciweidianji";
      } else {
        return "iconguanbigeci";
      }
    }
  },
  created() {
    this.touch = {};
  },
  mounted() {
    this.volume = this.playOptions.volume * 100;
    PubSub.subscribe("ToggleMiniindex", (msg, value) => {
      if (value) {
        this.$refs.MiniPlayer.style.zIndex = -1;
      } else {
        this.$refs.MiniPlayer.style.zIndex = 999;
      }
    });
  },
  methods: {
    showPlayList() {
      this.$refs.playlist.show();
    },
    back() {
      // 使用映射出的方法传递false到mutations
      this.setFullScreen(false);
    },
    open() {
      this.setFullScreen(true);
    },
    ...mapMutations({
      // 映射出方法,相当于提交一个mutations
      setFullScreen: "SET_FULL_SCREEN",
      setPlayerOpts: "SET_PLAYER_OPTIONS"
    }),
    ...mapActions(["savePlayerOptions", "savePlayHistory"]),
    // vue动画钩子提供两个参数一个EL(动画元素)，一个DONE回调函数到afterEnter
    enter(el, done) {
      const { x, y, scale } = this._getPosAndScale();
      let animation = {
        0: {
          // 第0帧的时候，先让图片缩小，显示在右下角(等于和小图重叠)
          transform: `translate3d(${x}px,${y}px,0) scale(${scale})`
        },
        60: {
          // 60%的时候，让图片回到cd中心，变大
          transform: `translate3d(0,0,0) scale(1.1)`
        },
        100: {
          // 变回原来的尺寸，会有一个回弹的效果
          transform: `translate3d(0,0,0) scale(1)`
        }
      };
      // 注册动画：
      animations.registerAnimation({
        name: "move",
        animation,
        presets: {
          duration: 400,
          easing: "linear"
        }
      });
      //运行动画,done也就是钩子中直接到afterEnter
      animations.runAnimation(this.$refs.cdWrapper, "move", done);
    },
    afterEnter() {
      //运行完动画之后，注销掉动画
      animations.unregisterAnimation("move");
      this.$refs.cdWrapper.style.animation = "";
    },
    // leave是指 cd从显示到隐藏的动画
    leave(el, done) {
      // 这里我们只要直接移动变小就可以了
      this.$refs.cdWrapper.style.transition = "all 0.4s";
      const { x, y, scale } = this._getPosAndScale();
      this.$refs.cdWrapper.style[
        transform
      ] = `translate3d(${x}px,${y}px,0) scale(${scale})`;
      // 监听transitionend 事件在 CSS 完成过渡后触发done回调
      this.$refs.cdWrapper.addEventListener("transitionend", done);
    },
    afterLeave() {
      this.$refs.cdWrapper.style.transition = "";
      this.$refs.cdWrapper.style[transform] = "";
    },
    updateTime(e) {
      // audio当前的播放时间，是一个可读写的属性：
      this.currentTime = e.target.currentTime;
    },
    formatTime(interval) {
      // |0相当于向下取整相当于math.floor
      interval = interval | 0;
      // 获取分
      const minute = ((interval / 60) | 0).toString().padStart(2, "0");
      // 获取秒
      const second = (interval % 60).toString().padStart(2, "0");
      return `${minute}:${second}`;
    },
    // 监听子组件派发的事件
    onProgressBarChange(percent) {
      const currentTime = this.currentSong.duration * percent;
      this.$refs.audio.currentTime = currentTime;
      if (!this.playing) {
        this.togglePlaying();
      }
      if (this.currentLyric) {
        this.currentLyric.seek(currentTime * 1000);
      }
    },
    _getPosAndScale() {
      // 因为改用rem所以算出屏幕比
      const radio = window.innerWidth / 750;
      // 算出小图片（中心点）相对大图片（中心点）的距离和缩放比例
      // 底部播放器图片的宽度
      const targetWidth = 40;
      // 底部播放器距离左边的距离(图片的中心点就是宽度一半20加margin-left:20)
      const paddingLeft = 40;
      // 底部播放器底部的距离(图片的中心点也就是高度的一半20加margin-bottom:10)
      const paddingBottom = 60 * radio;
      // 唱片容器到顶部为80像素
      const paddingTop = 240 * radio;
      // 大播放器图片的宽度是padding-bottom80撑开来的所以是屏幕的宽度*0.8
      const width = window.innerWidth * 0.8;
      // 初始的缩放比例就是小图片除以大图片的宽度
      const scale = targetWidth / width;
      // 初始的x坐标,因为是小图片相对大图片所以是负值宽度
      const x = -(window.innerWidth / 2 - paddingLeft);
      // 初始的y坐标（屏幕的高度减去标题的高度,再减去大图高的一半（因为是圆所以宽高一样），最后再减去底部距离）
      const y = window.innerHeight - paddingTop - width / 2 - paddingBottom;
      console.log(x, y);
      return {
        x,
        y,
        scale
      };
    },
    togglePlaying() {
      // 点击的时候取反设置vuex的状态
      if (!this.songReady) {
        return;
      }
      this.setPlayingState(!this.playing);
      if (this.currentLyric) {
        this.currentLyric.togglePlay();
      }
    },
    // 播放到下一首
    Musicend() {
      // 当是循环播放时候
      if (this.mode === playMode.loop) {
        this.loop();
      } else {
        this.next();
      }
    },
    loop() {
      this.$refs.audio.currentTime = 0;
      this.$refs.audio.play();
      if (this.currentLyric) {
        this.currentLyric.seek(0);
      }
    },
    next() {
      if (!this.songReady) {
        return;
      }
      if (this.playList.length === 1) {
        this.loop();
      } else {
        let index = this.currentIndex + 1;
        if (index === this.playList.length) {
          index = 0;
        }
        // 使用映射出来的方法名:
        this.setCurrentIndex(index);
        // 如果正在播放
        if (!this.playing) {
          this.togglePlaying();
        }
      }
      this.songReady = false;
    },
    prev() {
      if (!this.songReady) {
        return;
      }
      if (this.playList.length === 1) {
        this.loop();
      } else {
        let index = this.currentIndex - 1;
        if (index === -1) {
          index = this.playList.length - 1;
        }
        this.setCurrentIndex(index);
        // 如果正在播放
        if (!this.playing) {
          this.togglePlaying();
        }
      }
      this.songReady = false;
    },
    // 歌曲就绪：
    ready() {
      this.songReady = true;
      // 把当前歌曲写入播放历史
      this.savePlayHistory(this.currentSong);
    },
    error() {
      this.songReady = true;
    },

    // 直接跳转到带url的歌曲索引
    setErrorMusic() {
      let index = this.playList.findIndex(item => {
        return item.url !== null;
      });
      console.log(index);
    },
    getLyc() {
      this.currentSong
        .getLyc()
        .then(lyric => {
          this.currentLyric = new Lyric(lyric, this.handleLyric);
          if (this.playing) {
            this.currentLyric.play();
          }
        })
        .catch(() => {
          // 处理异常
          this.currentLyric = null;
          // this.playingLyric = "";
          this.currentLineNum = 0;
          this.playingLyric = "暂无歌词";
          this.$toast("暂无歌词");
        });
    },
    handleLyric({ lineNum, txt }) {
      this.currentLineNum = lineNum;
      if (lineNum > 5) {
        let lineEl = this.$refs.lyricLine[lineNum - 5];
        this.$refs.lyricList.scrollToElement(lineEl, 1000);
      } else {
        this.$refs.lyricList.scrollTo(0, 0, 1000);
      }
      this.playingLyric = txt;
    },
    // 歌词和cd之间的切换：
    middleTouchStart(e) {
      this.touch.init = true;
      const touch = e.touches[0];
      this.touch.startX = touch.pageX;
      this.touch.startY = touch.pageY;
    },
    middleTouchMove(e) {
      if (!this.touch.init) {
        return;
      }
      const touch = e.touches[0];
      const deltaX = touch.pageX - this.touch.startX;
      const deltaY = touch.pageY - this.touch.startY;
      if (Math.abs(deltaY) > Math.abs(deltaX)) {
        return;
      }
      const left = this.currentShow === "cd" ? 0 : -window.innerWidth;
      const offsetWidth = Math.min(
        0,
        Math.max(-window.innerWidth, left + deltaX)
      );
      this.touch.percent = Math.abs(offsetWidth / window.innerWidth);
      this.$refs.lyricList.$el.style[
        transform
      ] = `translate3d(${offsetWidth}px,0,0)`;
      this.$refs.lyricList.$el.style[transitionDuration] = 0;
      this.$refs.middleL.style.opacity = 1 - this.touch.percent;
      this.$refs.middleL.style[transitionDuration] = 0;
    },
    middleTouchEnd(e) {
      let offsetWidth;
      let opacity;
      if (this.currentShow === "cd") {
        if (this.touch.percent > 0.1) {
          offsetWidth = -window.innerWidth;
          opacity = 0;
          this.currentShow = "lyric";
        } else {
          offsetWidth = 0;
          opacity = 1;
        }
      } else {
        if (this.touch.percent < 0.9) {
          offsetWidth = 0;
          this.currentShow = "cd";
          opacity = 1;
        } else {
          offsetWidth = -window.innerWidth;
          opacity = 0;
        }
      }
      const time = 300;
      this.$refs.lyricList.$el.style[
        transform
      ] = `translate3d(${offsetWidth}px,0,0)`;
      this.$refs.lyricList.$el.style.transitionDuration = `${time}ms`;
      this.$refs.middleL.style.opacity = opacity;
      this.$refs.middleL.style.transitionDuration = `${time}ms`;
      this.touch.init = false;
    },
    middleClick(e) {
      const time = 300;
      if (this.currentShow === "cd") {
        // 切换到歌词：
        this.$refs.middleL.style.opacity = 0;
        this.$refs.middleL.style.zIndex = -1;
        this.$refs.middleL.style.transitionDuration = `${time}ms`;

        this.$refs.lyricList.$el.style.opacity = 1;
        this.$refs.lyricList.$el.style.zIndex = 1;
        this.$refs.lyricList.$el.transitionDuration = `${time}ms`;
        this.currentShow = "lyric";
      } else {
        // 切换回cd:因为是组件所以需要使用$el
        this.$refs.middleL.style.opacity = 1;
        this.$refs.middleL.style.zIndex = 1;
        this.$refs.middleL.style.transitionDuration = `${time}ms`;
        this.$refs.lyricList.$el.style.opacity = 0;
        this.$refs.lyricList.$el.style.zIndex = -1;
        this.$refs.lyricList.$el.transitionDuration = `${time}ms`;
        this.currentShow = "cd";
      }
    },
    toggleLyric() {
      console.log("1");

      this.middleClick();
    },
    MusicError(e) {
      this.$toast({
        message: "vip歌曲无法播放"
      });
    },
    voiceChange(value) {
      this.$refs.audio.volume = value / 100;
      // 提交actions记录下当前音量并保存到localstroage中：
      this.savePlayerOptions({
        volume: value / 100
      });
      this.$toast("当前音量：" + value);
    },
    togglemute() {
      if (this.mute) {
        this.$toast("取消静音");
        this.$refs.audio.volume = this.playOptions.volume;
      } else {
        this.$refs.audio.volume = 0;

        this.$toast("已经静音");
      }
      this.mute = !this.mute;
    },
    gotv() {
      this.$toast("投屏功能开发中");
    },
    tocomment(id) {
      let info = {};
      info.coverImgUrl = this.currentSong.image;
      info.name = this.currentSong.name;
      info.creator = {};
      info.creator.avatarUrl = this.currentSong.image;
      info.creator.nickname = this.currentSong.singer;
      this.setFullScreen(false);
      this.$router.push({
        name: "comments",
        query: {
          songid: id,
          info: info
        }
      });
    },
    // 获取当前歌曲的评论量：
    getCommentNum() {
      this.currentSong
        .getComment()
        .then(res => {
          if (res.total >= 999) {
            this.CommentNum = "999+";
          } else {
            this.CommentNum = res.total;
          }
        })
        .catch(() => {});
    }
  },
  watch: {
    // 监听歌曲变化
    currentSong(newSong, oldSong) {
        
        
      if (!newSong.id) {
        return;
      }
      if (newSong.id === oldSong.id) {
        return;
      }

 
      
   
      
      if (this.currentLyric) {
        this.currentLyric.stop();

        this.currentTime = 0;
        this.playingLyric = "";
        this.currentLineNum = 0;
      }
      clearTimeout(this.timer);
      this.timer = setTimeout(() => {
        this.$refs.audio.play();
        console.log(this.id);

        this.getLyc();
      }, 1000);
      this.getCommentNum();
    },
    // 监听这个vuex变量改变播放状态：
    playing(newPlaying) {
      this.$nextTick(() => {
        const audio = this.$refs.audio;
        newPlaying ? audio.play() : audio.pause();
      });
    }
  },
  components: {
    ProgressBar,
    ProgressCircle,
    Scroll,
    [Slider.name]: Slider,
    Playlist,
    VueStar
  },
  destroyed() {
    clearTimeout(this.timer);
  }
};
</script>

<style lang="less" scoped>
.player {
  .normal-player {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 999;
    background: @color-background;
    .background {
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      z-index: -1;
      opacity: 0.6;
      filter: blur(20px);
    }
    .top {
      position: relative;
      margin-bottom: 25px;
      .back {
        position: absolute;
        top: 0;
        left: 6px;
        z-index: 50;
        .iconfanhui {
          display: block;
          padding: 9px;
          color: @color-theme;
          transform: rotate(-90deg);
          font-size: @font-size-large-x;
          color: @color-theme;
          font-size: 24px;
        }
      }
      .title {
        width: 70%;
        margin: 0 auto;
        line-height: 40px;
        text-align: center;
        .sl;
        font-size: @font-size-large;
        color: @color-text;
      }
      .subtitle {
        line-height: 20px;
        text-align: center;
        font-size: @font-size-medium;
        color: @color-text;
      }
    }
    .middle {
      position: fixed;
      width: 100%;
      top: 3.2rem;
      bottom: 4.5rem;
      white-space: nowrap;
      font-size: 0;

      .middle-l {
        display: inline-block;
        vertical-align: top;
        position: relative;
        width: 100%;
        height: 0;
        padding-top: 70%;
        .cd-wrapper {
          position: absolute;
          left: 15%;
          top: 0;
          width: 70%;
          height: 100%;
          .cd {
            width: 100%;
            height: 100%;
            box-sizing: border-box;
            border: 10px solid rgba(255, 255, 255, 0.1);
            border-radius: 50%;
            &.play {
              animation: rotate 20s linear infinite;
            }
            &.pause {
              animation-play-state: paused;
            }
            .image {
              position: absolute;
              left: 0;
              top: 0;
              width: 100%;
              height: 100%;
              border-radius: 50%;
            }
          }
        }
      }
    }
    .bottom {
      position: absolute;
      bottom: 0.8rem;
      width: 100%;
      .operators {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 80%;
        margin: 0 auto;
        .icon {
          color: @mc;

          &.disable {
            color: @color-theme-d;
          }
          i {
            font-size: 30px;
          }
        }
        .i-left {
          text-align: right;
        }
        .i-center {
          padding: 0 20px;
          text-align: center;
          i {
            font-size: 40px;
          }
        }
        .i-right {
          text-align: left;
        }
        .iconlike {
          color: @color-sub-theme;
        }
      }
    }
    &.normal-enter-active,
    &.normal-leave-active {
      transition: all 0.4s;
      .top,
      .bottom {
        transition: all 0.4s cubic-bezier(0.86, 0.18, 0.82, 1.32);
      }
    }
    &.normal-enter,
    &.normal-leave-to {
      opacity: 0;
      .top {
        transform: translate3d(0, -100px, 0);
      }
      .bottom {
        transform: translate3d(0, 100px, 0);
      }
    }
  }
  .mini-player {
    display: flex;
    align-items: center;
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 999;
    width: 100%;
    height: 60px;
    background: @color-highlight-background;
    .icon {
      flex: 0 0 40px;
      width: 40px;
      height: 40px;
      margin: 0 10px 0 20px;
      &.disable {
        color: @color-theme-d;
      }
      .imgWrapper {
        height: 100%;
        width: 100%;
      }
      img {
        border-radius: 50%;
        &.play {
          animation: rotate 20s linear infinite;
        }
        &.pause {
          animation-play-state: paused;
        }
      }
    }
    .text {
      display: flex;
      flex-direction: column;
      justify-content: center;
      flex: 1;
      line-height: 20px;
      overflow: hidden;
      .name {
        .sl;
        margin-bottom: 2px;
        font-size: @font-size-medium;
        color: @color-text;
      }
      .desc {
        .sl;
        font-size: @font-size-small;
        color: @color-text-d;
      }
    }
    .control {
      flex: 0 0 30px;
      width: 30px;
      margin: 0 10px;
      .icon-mini {
        font-size: 31px !important;
        position: absolute;
        left: 0;
        top: 0;
        color: @color-theme-d !important;
      }

      .iconfont {
        font-size: 30px;
        color: @mc;
      }
      .iconsmlist {
        font-size: 30px;
        color: @color-theme-d;
        &.on {
          color: @mc;
        }
      }
    }
    &.mini-enter-active,
    &.mini-leave-active {
      transition: all 0.4s;
    }
    &.mini-enter,
    &.mini-leave-to {
      opacity: 0;
    }
  }
}
// 播放器进度条：
.progress-wrapper {
  display: flex;
  align-items: center;
  width: 80%;
  margin: 0px auto;
  padding: 10px 0;
  // margin: 0 10px;
  .time {
    color: @color-text;
    font-size: @font-size-small;
    flex: 0 0 30px;
    line-height: 30px;
    width: 30px;
    &.time-l {
      text-align: left;
    }
    &.time-r {
      text-align: right;
    }
  }
  .progress-bar-wrapper {
    flex: 1;
    margin: 0 10px;
  }
}
@keyframes rotate {
  0% {
    transform: rotate(0);
  }
  100% {
    transform: rotate(360deg);
  }
}

#effect-music {
  position: absolute;
  margin: auto;
  width: 100%;
  height: 100%;
  // overflow: hidden;
  left: 0;
  transform: scale(0.85);
}

#effect-music > .image {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  margin: auto;
  width: 200px;
  height: 200px;
  background: url(https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1575820971101&di=935fabf797c3b30f45f7ed90666f9399&imgtype=0&src=http%3A%2F%2Fimglf1.ph.126.net%2FJceVstVIHMeAlbMvdbYwlA%3D%3D%2F2456713596830921578.jpg);
  background-size: cover;
  background-position: center center;
  border-radius: 50%;
  -webkit-border-radius: 50%;
  -moz-border-radius: 50%;
  -ms-border-radius: 50%;
  -o-border-radius: 50%;
  animation: rotate 10s linear 0s infinite;
  -webkit-animation: rotate 10s linear 0s infinite;
}

#effect-music > .wave {
  position: absolute;
  opacity: 0;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  margin: auto;
  width: 204px;
  height: 204px;
  border-radius: 50%;
  border: 2px solid #eee;
  animation: wave 4s linear 0s infinite;
  -webkit-animation: wave 4s linear 0s infinite;
}

#effect-music > .wave::after {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 6px;
  height: 6px;
  overflow: hidden;
  border-radius: 5px;
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
  -ms-border-radius: 5px;
  -o-border-radius: 5px;
  background-color: #ccc;
}

#effect-music > .wave:nth-child(2) {
  animation-delay: 1s;
}

#effect-music > .wave:nth-child(3) {
  animation-delay: 2s;
}

#effect-music > .wave:nth-child(4) {
  animation-delay: 3s;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -ms-transform: rotate(0deg);
    -o-transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
    -webkit-transform: rotate(360deg);
    -moz-transform: rotate(360deg);
    -ms-transform: rotate(360deg);
    -o-transform: rotate(360deg);
  }
}

@keyframes wave {
  from {
    opacity: 1;
    transform: rotate(0deg) scale(1);
    -webkit-transform: rotate(0deg) scale(1);
    -moz-transform: rotate(0deg) scale(1);
    -ms-transform: rotate(0deg) scale(1);
    -o-transform: rotate(0deg) scale(1);
  }
  to {
    opacity: 0;
    transform: rotate(-300deg) scale(2.2);
    -webkit-transform: rotate(-300deg) scale(2.2);
    -moz-transform: rotate(-300deg) scale(2.2);
    -ms-transform: rotate(-300deg) scale(2.2);
    -o-transform: rotate(-300deg) scale(2.2);
  }
}
.middle-r {
  display: inline-block;
  vertical-align: top;
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  z-index: -1;
  .lyric-wrapper {
    width: 80%;
    margin: 0 auto;
    overflow: hidden;
    text-align: center;
    .text {
      line-height: 32px;
      color: @color-text-l;
      font-size: @font-size-medium;
      &.current {
        color: @color-text;
      }
    }
  }
}
.dot-wrapper-flex {
  .flex-row-nowrap(center);
  justify-content: space-around;

  .commenticon {
    position: relative;
    i {
      font-size: 28px;
    }
    span {
      position: absolute;
      left: calc(100% - 10px);
      top: -2px;
      color: #fff;
      font-size: 12px;
    }
  }
}
.dot-wrapper {
  text-align: center;
  font-size: 0;
  height: 40px;
  .iconfontlyric {
    font-size: 36px;
  }
  // .dot {
  //   display: inline-block;
  //   vertical-align: middle;
  //   margin: 0 4px;
  //   width: 8px;
  //   height: 8px;
  //   border-radius: 50%;
  //   background: @color-text-l;
  //   &.active {
  //     width: 20px;
  //     border-radius: 5px;
  //     background: @color-text-ll;
  //   }
  // }
}
.playing-lyric-wrapper {
  width: 80%;
  margin: 1.6rem auto 0 auto;
  overflow: hidden;
  text-align: center;
  .playing-lyric {
    height: 20px;
    line-height: 20px;
    font-size: @font-size-medium;
    color: @color-text-l;
  }
}
.audio-voice-control {
  position: relative;
  padding: 0 0.3333rem;
  height: 60px;
  bottom: 20px;
  width: 100%;
  font-size: 16px;
  .flex-nowrap-sb(center);
  .vanslider {
    flex: 1;
    margin: 0 15px;
  }
  i.iconVoice {
    color: #fff;
    .extend-click;
    font-size: 18px;
  }
}
.nolyric {
  text-align: center;
  .cf;
  color: #fff;
  font-size: 16px;
}
/deep/.audio-voice-control .van-slider__bar .van-slider__button {
  .extend-click;
}

@-webkit-keyframes rubberBand {
  0% {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }
  30% {
    -webkit-transform: scale3d(1.25, 0.75, 1);
    transform: scale3d(1.25, 0.75, 1);
  }
  40% {
    -webkit-transform: scale3d(0.75, 1.25, 1);
    transform: scale3d(0.75, 1.25, 1);
  }
  50% {
    -webkit-transform: scale3d(1.15, 0.85, 1);
    transform: scale3d(1.15, 0.85, 1);
  }
  65% {
    -webkit-transform: scale3d(0.95, 1.05, 1);
    transform: scale3d(0.95, 1.05, 1);
  }
  75% {
    -webkit-transform: scale3d(1.05, 0.95, 1);
    transform: scale3d(1.05, 0.95, 1);
  }
  100% {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }
}
@keyframes rubberBand {
  0% {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }
  30% {
    -webkit-transform: scale3d(1.25, 0.75, 1);
    transform: scale3d(1.25, 0.75, 1);
  }
  40% {
    -webkit-transform: scale3d(0.75, 1.25, 1);
    transform: scale3d(0.75, 1.25, 1);
  }
  50% {
    -webkit-transform: scale3d(1.15, 0.85, 1);
    transform: scale3d(1.15, 0.85, 1);
  }
  65% {
    -webkit-transform: scale3d(0.95, 1.05, 1);
    transform: scale3d(0.95, 1.05, 1);
  }
  75% {
    -webkit-transform: scale3d(1.05, 0.95, 1);
    transform: scale3d(1.05, 0.95, 1);
  }
  100% {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }
}
/deep/.animated {
  -webkit-animation-duration: 1.66s;
  animation-duration: 1.66s;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
}
/deep/.rubberBand {
  -webkit-animation-name: rubberBand;
  animation-name: rubberBand;
}
/deep/.VueStar__ground {
  width: 60px !important;
  height: 60px !important;
}
/deep/.VueStar__decoration {
  width: 100px !important;
  height: 100px !important;
  left: -30% !important;
  top: -30% !important;
  right: inherit !important;
  bottom: inherit !important;
}
/deep/.VueStar {
  position: relative;
  right: 0rem;
}
</style>